#include "mybutton2.h"
#include<QDebug>
#include <QPainter>
MyButton2::MyButton2(QWidget *parent) : QPushButton(parent)
{
   //this->setAutoFillBackground(true);
    this->flag=false;
}

void MyButton2::setpicture(QString enter, QString normal,QString chick)
{
    this->m_enter=enter;
    this->m_normal=normal;
    this->m_chick=chick;
    this->pictureshow.load(m_normal);
发大水范德萨恶打撒达大苏打的撒的撒的撒大啊实打实的
void MyButton2::leaveEvent(QEvent *ev)
{
    Q_UNUSED(ev);
    this->pictureshow.load(this->m_normal);
    update();
}

void MyButton2::keyPressEvent(QKeyEvent *ev)
{
    Q_UNUSED(ev);
    this->pictureshow.load(this->m_enter);
    update();
}

void MyButton2::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);
    QPainter painter(this);
    if(flag){
         painter.drawPixmap(0,0,23,40,this->pictureshow);
    }
    else{
         painter.drawPixmap(rect(),this->pictureshow);
    }
    update();
}
